package wangjg.mda.model.obj;

import java.util.HashMap;
import java.util.Map;

public class ModelDataType {

	public static final String BYTE		=	"Byte";
	public static final String CHAR		=	"Character";
	public static final String SHORT	=	"Short";
	public static final String INTEGER	=	"Integer";
	public static final String LONG		=	"Long";
	public static final String FLOAT	=	"Float";
	public static final String DOUBLE	=	"Double";
	
	public static final String STRING	=	"String";
	public static final String DATE		=	"Date";
	public static final String BOOLEAN		=	"Boolean";
	@Deprecated
	public static final String TIMESTAMP=	"Timestamp";
	
	public static final Map<String,String> primitiveMap = new HashMap<String,String>();

	static{
		primitiveMap.put("Byte", "byte");
		primitiveMap.put("Character", "char");
		primitiveMap.put("Short", "short");
		primitiveMap.put("Integer", "int");
		primitiveMap.put("Long", "long");
		primitiveMap.put("Float", "float");
		primitiveMap.put("Double", "double");
		primitiveMap.put("Boolean", "boolean");
		
		//java primitive
		primitiveMap.put("String", "String");
		primitiveMap.put("Date", "Date");
		
		primitiveMap.put(TIMESTAMP, TIMESTAMP);
	}
	
	public static boolean isPrimitive(String type){
		if(type==null){
			return false;
		}
		if(ModelDataType.primitiveMap.containsKey(type)||ModelDataType.primitiveMap.containsValue(type)){
			return true;
		}
		return false;
	}
}
